<?php
/*
商品详情
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;

$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$basic=$this->setting;
$return['set']=$basic;
$return['setting']=$basic;
$return['pluginset']['footernav']=$this->setting['footernav4'];
if($_SESSION['onemerchid']){
	$return['member']=model('jy_merch/member')->getdetail($_SESSION['onemerchid'],$_SESSION['uid']);
}else{
	$return['member']=pdo_get('core_members',array('uniacid'=>$_SESSION['uniacid'],'id'=>$_SESSION['uid']));
}
if($_RQ['op']=='main'){
	$params=array('credit_type'=>4,'paymerchid'=>$_SESSION['onemerchid'],'uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']);
	if($_RQ['type']){
		$params['type']=$_RQ['type'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_creditshop_log',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	if($list){
		$credit_types=credit_types(true);
		foreach($list as &$item){
			$item['createtime'] = date('Y-m-d H:i:s', $item['createtime']);
			$item['goods'] = pdo_get('jy_creditshop_goods',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['goodsid']),array('title','thumb'));
			$item['statustitle'] = $this->order_status[$item['status']];
			$item['credit_typetitle']=$credit_types[$item['credit_type']];
		}
	}
	$return['list']=$list;
	set_html('title',$basic['title']?'参与记录-'.$basic['title']:'参与记录');
	$return['sharedata']=array(
		'title'=>$basic['share_title'],
		'desc'=>$basic['share_desc'],
		'link'=>custom_url('jy_guashop/creditshop.goods/',true),
		'imgUrl'=>ATTACHMENT_URL.$basic['share_image'],
	);
	exi($return);
}
